Basic checks

Hi, I'm new to DXL development, and would like to put some standard "Check for module in edit mode" kind of checks in all the scripts.  Can someone point me to some decent documentation on this subject?

 

Thanks in advance!


bucket - Wed Jun 04 12:45:06 EDT 2014

Re: Basic checks
Mathias Mamsch - Wed Jun 04 12:49:44 EDT 2014

There is no decent documentation on DXL - at least not until your best friend becomes the normal DXL help (that you need to read over and over again). You can find a lot of information in there, for example the isEdit (Module) function, that allows you to check if a Module is opened in edit mode, etc.  If you check the DXL Help on the modules section you will find a lot of functions, that may do what you want. A nice trick, if you want to see how "the pros" are doing it, is to take a function and look for it on this forum in the search. Looking for example for "isEdit" you will find a lot of discussions and example code.

Hope that helps, regards, Mathias

Re: Basic checks
bucket - Wed Jun 04 13:04:00 EDT 2014

Mathias Mamsch - Wed Jun 04 12:49:44 EDT 2014

There is no decent documentation on DXL - at least not until your best friend becomes the normal DXL help (that you need to read over and over again). You can find a lot of information in there, for example the isEdit (Module) function, that allows you to check if a Module is opened in edit mode, etc.  If you check the DXL Help on the modules section you will find a lot of functions, that may do what you want. A nice trick, if you want to see how "the pros" are doing it, is to take a function and look for it on this forum in the search. Looking for example for "isEdit" you will find a lot of discussions and example code.

Hope that helps, regards, Mathias

Thank you.  That's all I was expecting :)

Re: Basic checks
llandale - Wed Jun 04 16:39:18 EDT 2014

yes, "isEdit" is pretty common.  However, if you do not allow the dialog "Module locked, open read?", then successfully opening the module with the "edit" command guarantees it is open edit.  This option is the "Silent" option, which I highly recommend so you don't have to babysit your running code.

  • Module mod = edit(NameFull, false, true, true)   // bools: [1] Invisible, [2] Silent, [3] load Standard View
  • if (null mod) then some problem
  • else module is indeed open edit.

"isEdit(mod)" is partularly useful if your script is considering currently opened modules.  If your script has the module has the natural context (in an "Addins" menu), certainly checking for "isEdit" is useful if your script figures to modify things.

  • Module mHome = current()
  • if (null mHome or !isEdit(mHome)) then {infoBox("Run from edit open module"); halt}

See also "isShare(Module)".

-Louie